import tkinter as tk
import logging
from tkinter import messagebox
from core.monitor import AShareRealTimeMonitor

# 配置日志
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

def main():
    root = tk.Tk()
    try:
        # 初始化并启动监控程序
        app = AShareRealTimeMonitor(root)
        root.mainloop()
    except Exception as e:
        logger.critical(f"程序异常终止: {str(e)}")
        messagebox.showerror("致命错误", f"程序发生异常: {str(e)}")

if __name__ == "__main__":
    main()